﻿using B.MES.Customer.Application.IApplication;
using B.MES.Customer.Domain;
using B.MES.Customer.Domain.DTO;
using B.MES.Customer.Infrastructure.IRepository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B.MES.Customer.Application.Application
{
    /// <summary>
    /// 支出服务实现层
    /// </summary>
    public class AdditionalExpenditureApplication : BaseApplication<AdditionalExpenditure>, IAdditionalExpenditureApplication
    {
        private readonly IAdditionalExpenditureRepository _additionalExpenditureRepository;
        public AdditionalExpenditureApplication(IAdditionalExpenditureRepository additionalExpenditureRepository) : base(additionalExpenditureRepository)
        {
            _additionalExpenditureRepository = additionalExpenditureRepository;
        }

        public int AddadditionalExpenditure(AdditionalExpenditure additionalExpenditure)
        {
            var result = _additionalExpenditureRepository.AddadditionalExpenditure(additionalExpenditure);
            return result;
        }

        public APIResult<AdditionalExpenditure> DeleteAdditionalExpenditure(int NewExpenditureId)
        {
          var result = _additionalExpenditureRepository.DeleteAdditionalExpenditure(NewExpenditureId);  
            return result;  
        }

        public APIResult<List<AdditionalExpenditure>> DeleteAdditionalExpenditure(List<AdditionalExpenditure> list)
        {
             var result= _additionalExpenditureRepository.DeleteAdditionalExpenditure(list);
            return result;
        }

        public AdditionalExpenditure EditAdditionalExpenditure(int NewExpenditureId)
        {
            var result= _additionalExpenditureRepository.EditAdditionalExpenditure(NewExpenditureId);   
            return result;
        }

        public PageApiResut<AdditionalExpenditureDTO> GetAdditionalExpenditure(int PageIndex, int PageSize)
        {
            var result = _additionalExpenditureRepository.GetAdditionalExpenditure(PageIndex, PageSize);
            return result;
        }

        public List<ExpenditureType> GetExpenditureType()
        {
           var result=_additionalExpenditureRepository.GetExpenditureType();
            return result;
        }
        /// <summary>
        /// 更新支出信息
        /// </summary>
        /// <param name="additionalExpenditure"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public APIResult<AdditionalExpenditure> UpdateAdditionalExpenditure(AdditionalExpenditure additionalExpenditure)
        {
            var result = _additionalExpenditureRepository.UpdateAdditionalExpenditure(additionalExpenditure);
            return result;
        }
    }
}
